package com.kgc.ssm.service.impl;

import com.kgc.ssm.entity.EnquireDetailExample;
import com.kgc.ssm.entity.QuoteDetail;

import com.kgc.ssm.entity.QuoteExample;
import com.kgc.ssm.entity.dto.QuotationResult;
import com.kgc.ssm.mapper.QuoteMapper;
import com.kgc.ssm.service.QuoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class QuoteServiceImpl implements QuoteService {
    @Resource
    private QuoteMapper quoteMapper;
    @Override
    public List<QuotationResult> seleQuotationByMaterCode(List<String> materialCodes) {

        return quoteMapper.seleQuotationByMaterCode(materialCodes);
    }

    @Override
    public Boolean deleteQuote(List<String> queTitles) {
        if(queTitles ==null || queTitles.isEmpty()){
            return  false;
        }
        QuoteExample example=new QuoteExample();
        // 构造删除条件：queeTitles 中的每个标题对应的记录都会被删除
        for (String queTitle : queTitles) {
            example.or().andQueTitleEqualTo(queTitle); // 假设字段名是 quoteTitle
        }

        int affectedRows = quoteMapper.deleteByExample(example); // 执行删除操作

        return affectedRows > 0; // 根据受影响的行数返回布尔值
    }


}
